﻿using System;
using System.Diagnostics;
using System.Xml.Linq;

namespace OneBusAway.Entities
{
    public class Route
    {
        public string Id { get; private set; }
        public string ShortName { get; private set; }
        public string Description { get; private set; }
        public RouteType Type { get; private set; }
        public int AgencyId { get; private set; }

        public Route(XElement route)
        {
            Debug.Assert(route != null);
            Debug.Assert(route.Name == "route");

            this.Id = route.Element("id").Value;
            this.ShortName = route.Element("shortName").Value;
            this.Description = route.Element("description").Value;
            this.Type = (RouteType)Enum.Parse(typeof(RouteType), route.Element("type").Value, true);
            this.AgencyId = int.Parse(route.Element("agencyId").Value);
        }
    }
}
